package 一维数组.习题;
//存在连续三个奇数的数组
public class text_7 {
    public static void main(String[] args) {
        int[] array ={1,2,3,5,7};
        Boolean b = fun1(array);
        System.out.println(b);
    }
    public static boolean fun1(int[] array){
        for (int i = 0; i < array.length; i++) {
            for (int j = i+1; j < array.length; j++) {
                for (int k = j+1; k < array.length; k++) {
                    if(array[i]%2==1 && array[j]%2==1 && array[k]%2==1){
                      return true;
                    }
                }
            }
        }
        return false;
    }
    public static boolean fun2(int[] array){
        int count = 0;
        for (int i = 0; i < array.length; i++) {
            if(array[i]%2==1){
                count++;
                if(count==3){
                    return true;
                }
            }else {
                count=0;
            }
        }
        return false;
    }
}
